<template>
  <div class="category">
    <page-search
      :searchFormConfig="searchFormConfig"
      @searchBtnClick="hanldeSearchBtnClick"
      @resetBtnClick="hanldeResetBtnClick"
    ></page-search>
    <page-content
      ref="pageContentRef"
      pageName="category"
      :contentTableConfig="contentTableConfig"
      @newBtnClick="handleNewData"
      @handleEditorRow="handleEditorRow"
    >
    </page-content>
    <page-modal
      ref="pageModalRef"
      pageName="department"
      :modalInfo="modalInfo"
      :modalConfig="modalConfig"
    ></page-modal>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, reactive } from "vue";
import pageSearch from "@/components/page-search";
import pageContent from "@/components/page-content";
import pageModal from "@/components/page-modal";

import { searchFormConfig } from "./config/search.config";
import { contentTableConfig } from "./config/content.config";
import { modalConfig } from "./config/modal-config";

import { usePageSearch } from "@/hooks/usePageSearch";
import { usePageModal } from "@/hooks/usePageModal";

export default defineComponent({
  components: { pageSearch, pageContent, pageModal },
  setup() {
    const { pageContentRef, hanldeSearchBtnClick, hanldeResetBtnClick } =
      usePageSearch();
    const { pageModalRef, modalInfo, handleNewData, handleEditorRow } =
      usePageModal();
    return {
      searchFormConfig,
      hanldeSearchBtnClick,
      hanldeResetBtnClick,
      pageContentRef,
      contentTableConfig,
      modalConfig,
      pageModalRef,
      modalInfo,
      handleNewData,
      handleEditorRow,
    };
  },
});
</script>
